
import { IsString, IsNumber, IsBoolean, IsDate, IsOptional, IsEnum, IsArray } from 'class-validator';
import { ApiProperty, OmitType, IntersectionType } from '@nestjs/swagger';
import { PagingDto } from 'src/common/dto/index';
import { CharEnum } from 'src/common/enum/index';
import { Type } from 'class-transformer';


export class BaseIssuesDto{
	@ApiProperty({required: false , description: 'id'})
	@IsOptional()
	@IsNumber()
	@Type(() => Number)
	id?: number;

	@ApiProperty({required: false , description: 'question'})
	@IsOptional()
	@IsString()
	question?: string;

	@ApiProperty({required: false , description: 'hint'})
	@IsOptional()
	@IsString()
	hint?: string;

	@ApiProperty({enum: CharEnum, required: false , description: '删除标志'})
	@IsOptional()
	@IsString()
	delFlag?: string;

	@ApiProperty({required: false , description: '创建时间'})
	@IsOptional()
	@IsArray()
	@IsString({ each: true })
	createTime?: Array<string>;

	@ApiProperty({required: false , description: '更新时间'})
	@IsOptional()
	@IsArray()
	@IsString({ each: true })
	updateTime?: Array<string>;

}

export class CreateIssuesDto extends OmitType(BaseIssuesDto, ['id','delFlag','createTime']){}

export class UpdateIssuesDto extends OmitType(BaseIssuesDto, ['delFlag','createTime']){}

export class QueryIssuesDto extends IntersectionType(BaseIssuesDto, PagingDto){}

export class ListIssuesDto extends OmitType(BaseIssuesDto, ['delFlag','createTime','updateTime']){}
